/**
 * 
 */
package com.usc.entme;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.widget.Toast;

/**
 * @author pranav
 *
 */
public class Preferences extends PreferenceActivity {

	 private boolean bbcNews;


	 
	@Override
     protected void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
             addPreferencesFromResource(R.xml.preferences);
             
             
             // Get the custom preference
             Preference bbcNewsPref = (Preference) findPreference("bbcNewsPref");
             
            /* bbcNewsPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {

                                     public boolean onPreferenceClick(Preference preference) {
                                    	 
                                             Toast.makeText(getBaseContext(),
                                                             "The bbcNewsPref preference has been clicked",
                                                             Toast.LENGTH_LONG).show();
                                             
                                             SharedPreferences customSharedPreference = getSharedPreferences(
                                            		 "bbcNewsPref", Activity.MODE_PRIVATE);
                                             SharedPreferences.Editor editor = customSharedPreference.edit();
                                             editor.putBoolean("bbcNewsPref",!bbcNews);
                                             editor.commit();
                                             return true;
                                     }

                             });*/
     }
	 
	 
	 /* (non-Javadoc)
	 * @see android.preference.PreferenceActivity#onStop()
	 */
	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
	}


	/* (non-Javadoc)
	 * @see android.app.Activity#onStart()
	 */
	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		getPrefs();
	}


	private void getPrefs() {
         // Get the xml/preferences.xml preferences
         SharedPreferences prefs = PreferenceManager
                         .getDefaultSharedPreferences(getBaseContext());
         bbcNews = prefs.getBoolean("bbcNewsPref", true);
	 }
}
